Skip to content

optimize XDR serialization in serialize.c#234

Open
kevinushey wants to merge 1 commit intor-devel:mainfrom
kevinushey:feature/serialization-optimizations
Open

optimize XDR serialization in serialize.c#234
kevinushey wants to merge 1 commit intor-devel:mainfrom
kevinushey:feature/serialization-optimizations

Conversation

@kevinushey
Copy link
Copy Markdown

Summary

  • Replace per-element XDR library vtable dispatch (xdrmem_create/xdr_int/xdr_double/xdr_destroy) with an inline R_swap32 byte-swap for bulk integer, real, and complex vector serialization and deserialization, enabling compiler autovectorization of the inner loops
  • For deserialization (InIntegerVec, InRealVec, InComplexVec), read directly into the target SEXP buffer and byte-swap in place, eliminating the static intermediate buf
  • Buffer character output in OutString to reduce per-character OutBytes calls
  • Remove redundant sscanf into a second buffer in InInteger and InRealInWord already provides the parsed token
  • Increase reference hash table size from 1099 to 6151 to reduce collisions
  • Cache strlen(PRIMNAME(s)) to avoid computing it twice in WriteItem

Test plan

  • Verify make check passes (serialization round-trips are exercised extensively by the test suite)
  • Benchmark serialize()/unserialize() on large integer, double, and complex vectors to confirm performance improvement
  • Test on both little-endian (x86_64, aarch64) and big-endian targets to verify WORDS_BIGENDIAN paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant